import time

from selenium.webdriver.common.by import By
from data_023.Base.Base import Base

class Page(Base):
    # 点击登录
    login = (By.XPATH,'//html/body/div[1]/div/div[2]/ul/li[1]/a')
    def login_loc(self):
        self.click(self.login)
    # 输入用户名
    username_01 = (By.XPATH,'//*[@id="theForm"]/div[1]/span[2]/input')
    def username(self):
        self.send_keys(self.username_01,'17660387762')
    # 输入密码
    password_01 = (By.XPATH, '//*[@id="theForm"]/div[1]/span[2]/input')
    def password(self):
        self.send_keys(self.password_01, '123456')
    # 点击登录按钮
    dl=(By.XPATH,'//*[@id="theForm"]/div[5]/a')
    def dl_01(self):
        self.click(self.dl)
    # 断言登录成功
    login_02 = (By.XPATH,'/html/body/div[5]/div[2]/div[1]/div[2]/div[2]/ul/li[1]')
    def dy02(self):
        aa = self.find_element(self.login_02).text()
        assert '您好，17660387762 欢迎回来' in aa
        print(aa)
    # 点击首页
    shouye = (By.XPATH,'/html/body/div[3]/div[2]/ul/li[1]/a')
    def shouye(self):
        self.click(self.shouye)
    def A3mall_001(self):
        self.open_url('http://10.59.9.14:7003/')
        self.login_loc()
        self.username()
        self.password()
        time.sleep(7)
        self.dl_01()
        self.dy02()
        self.dy02()